// components/system/reply_1/reply_1.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        diseaseList: []
    },

    /**
     * 组件的方法列表
     */
    methods: {
        onReachBottom(){

        }
    },
    lifetimes: {
        async attached() {
            let userId = wx.getStorageSync('userId')
            console.log(userId)
            //等待promise的结果
            let res = await new Promise((resolve, reject) => {
                wx.request({
                    url: `http://120.77.156.205:8808/wx/disease/getExpert/${userId}/1`,
                    method: 'GET',
                    success: (res) => {
                        resolve(res)
                    },
                    fail: (err) => {
                        reject(err)
                    }
                })

            })
            console.log(res)

            if (res.data.code == 0) {
                this.setData({
                    diseaseList: res.data.data.diseaseVoList
                })
                
            } else {
                wx.showToast({
                    title: '服务器异常',
                    icon: "error"
                })
            }

        }
    }
})
